package cn.yunhe.aop;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Component;

import cn.yunhe.action.OprAction;


@Component
@Aspect
@EnableAspectJAutoProxy(proxyTargetClass = true)
public class ServiceAop {
	private static Logger logger = LogManager.getLogger(OprAction.class);
	
	@After("execution(* cn.yunhe.controller.*.*(..))")
	public void endService(){
		logger.info("数据库操作结束");
	}
	
	@Before("execution(* cn.yunhe.controller.*.*(..))")
	public void startService(){
		logger.info("数据库操作开始");
	}
}
